package com.sali.b_design_pattern.g_singleton_pattern.lesson_singleton.a_hungry.thread;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/19 12:37.
 * @version: 1.0
 */
public class ThreadTest {

    public static void main(String[] args) {
//        Thread thread1 = new Thread(new HungryThread());
//        Thread thread2 = new Thread(new HungryThread());
//
//        thread1.start();
//        thread2.start();
        // 得出结论：饿汉单例是线程安全的

        System.out.println("==========");

        Thread thread3 = new Thread(new StaticHungryThread());
        Thread thread4 = new Thread(new StaticHungryThread());

        thread3.start();
        thread4.start();
    }

}
